package com.yodawnla.easyPuyo.stage;

public class Stage
{
	boolean mIsUnlocked = false;
	int mPercent = 0;
	
	public Stage()
	{
		mIsUnlocked = false;
		mPercent = 0;
	}
	
	public Stage(boolean unlocked)
	{
		mIsUnlocked = unlocked;
		mPercent = 0;
	}
	
	public Stage(int percent)
	{
		mPercent = percent;
		mIsUnlocked = true;
	}
	
	public void set(boolean unlock, int percent)
	{
		mIsUnlocked = unlock;
		mPercent = percent;
	}
	
	public void unlock()
	{
		mIsUnlocked = true;
	}
	
	public boolean isUnlocked()
	{
		return mIsUnlocked;
	}
	
	public int addPercent(int value)
	{
		mPercent += value;
		if (mPercent >= 100)
			mPercent = 100;
		
		return mPercent;
	}
	
	public int getPercent()
	{
		return mPercent;
	}
	
	public String getSaveString()
	{
		String unlock;
		
		if (mIsUnlocked)
			unlock = "t";
		else
			unlock = "f";
		
		return mPercent+"#"+unlock+"!";
	}
}
